package com.example.ruijiproject.controller;

import com.example.ruijiproject.domain.Result;
import com.example.ruijiproject.domain.SetmealDto;
import com.example.ruijiproject.service.SetmealDishService;
import com.example.ruijiproject.service.SetmealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/setmeal")
public class SetmealController {
    @Autowired
    private SetmealDishService setmealDishService;

    @Autowired
    private SetmealService setmealService;

    @PostMapping
    public Result<String> save(@RequestBody SetmealDto setmealDto) {
        log.info("添加套餐: {}", setmealDto);
        setmealService.saveWithDish(setmealDto);
        return Result.success("添加套餐成功！");
    }
}
